package com.stark.wechat.service.draft.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 图片消息里的图片相关信息
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class ImageInfo implements Serializable {

    private static final long serialVersionUID = -3879442193662143699L;

    /**
     * 图片列表
     */
    @JsonProperty("image_list")
    private List<Image> imageList = new ArrayList<>();

    /**
     * 添加图片
     *
     * @param image 图片信息
     * @return 当前对象
     */
    public ImageInfo addImage(Image image) {
        this.imageList.add(image);
        return this;
    }

    /**
     * 图片
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Accessors(chain = true)
    public static class Image implements Serializable {

        private static final long serialVersionUID = -8523182274724197171L;

        /**
         * 图片消息里的图片素材id（必须是永久MediaID）
         * <p>*必填
         */
        @JsonProperty(value = "image_media_id", required = true)
        private String imageMediaId;

    }

}
